4.13   Notification Conditions

This section describes behavior of the Notification Conditions object in MWS. It contains the URLs, request bodies, and responses delivered to and from MWS.

The Notification Conditions API was introduced with API version 3, and is not available with older API versions. The supported methods table below requires each resource to be accessed with a URL parameter of api-version=3. For more information, see 3.4  Requesting Specific API Versions.

The 8.4.10 Fields: Notification Conditions reference contains the type and description of all fields in the Notification Conditions object.

Supported Methods

Resource GET PUT POST DELETE
/rest/notification-conditions Get All Notification Conditions Update Notification Condition -- --
/rest/notification-conditions/<id> Get Single Notification Condition -- -- --

In this section:

4.13.1 Getting Notification Conditions

The HTTP GET method is used to retrieve Notification Condition information.

Quick Reference

GET https://localhost:8080/mws/rest/notification-conditions?api-version=3
GET https://localhost:8080/mws/rest/notification-conditions/<id>?api-version=3

4.13.1.A  Get All Notification Conditions

URLs and Parameters

GET https://localhost:8080/mws/rest/notification-conditions?api-version=3[&query={"escalationLevel":"ADMIN"}][&sort={"observedDate":-1}]
Parameter Required Type Description Example
query No JSON

Query for specific results.

It is possible to query notifications by one or more fields based on MongoDB query syntax.

query={"escalationLevel":"ADMIN"}
sort No JSON

Sort the results. Use 1 for ascending and -1 for descending.

sort={"observedDate":-1}

See 3.3  Global URL Parameters for available URL parameters.

Sample Response

GET https://localhost:8080/mws/rest/notification-conditions?api-version=3&query={"escalationLevel":"ADMIN"}&sort={"observedDate":-1}
------------------------------------
            
 {
    "totalCount": 2,
    "resultCount": 2,
    "results": [
        {
            "createdDate": "2024-09-10 23:13:33 UTC",
            "details": {
                "pluginType": "NodeUtilizationReport",
                "pluginId": "node-report"
            },
            "escalationLevel": "ADMIN",
            "expirationDate": null,
            "expirationDuration": null,
            "message": "The node 'testnode' has not been updated since the last poll, which is likely due to a misconfiguration.",
            "objectId": "testnode",
            "objectType": "Node",
            "observedDate": "2024-09-10 23:13:33 UTC",
            "origin": "MWS/plugins/NodeUtilizationReport/node-report",
            "id": "522fa79de4b0cafeaec6f83e"
        },
        {
            "createdDate": "2024-09-11 17:19:35 UTC",
            "details": {
                "pluginType": "VCenter",
                "pluginId": "vcenter42"
            },
            "escalationLevel": "ADMIN",
            "expirationDate": null,
            "expirationDuration": null,
            "message": "The node 'node1' does not have vcenter tools installed, therefore the state is unknown and migrations may not work correctly",
            "objectId": null,
            "objectType": "System",
            "observedDate": "2024-09-11 17:19:35 UTC",
            "origin": "MWS/plugins/VCenter/vcenter42",
            "id": "5230a627e4b0d51bef490e86"
        }
    ]
}

4.13.1.B  Get Single Notification Condition

URLs and Parameters

GET https://localhost:8080/mws/rest/notification-conditions/<id>?api-version=3
Parameter Required Type Description
id Yes String The unique identifier of the object.

See 3.3  Global URL Parameters for available URL parameters.

Sample Response

GET https://localhost:8080/mws/rest/notification-conditions/521a1f18e4b0e3f9031f47f5?api-version=3
------------------------------------

{
    "createdDate": "2024-09-10 23:13:33 UTC",
    "details": {
        "pluginType": "NodeUtilizationReport",
        "pluginId": "node-report"
    },
    "escalationLevel": "ADMIN",
    "expirationDate": null,
    "expirationDuration": null,
    "message": "The node 'testnode' has not been updated since the last poll, which is likely due to a misconfiguration.",
    "objectId": "testnode",
    "objectType": "Node",
    "observedDate": "2024-09-10 23:13:33 UTC",
    "origin": "MWS/plugins/NodeUtilizationReport/node-report",
    "id": "522fa79de4b0cafeaec6f83e"
}

4.13.2 Updating Notification Conditions

The HTTP PUT method is used to update Notification Condition information. The PUT operation is idempotent, meaning that is used for both creating new notification conditions and updating existing ones. If the escalationLevel, origin, message, objectType, and objectId fields match an existing notification condition, it will be updated. Otherwise, a new condition will be created.

Quick Reference

PUT https://localhost:8080/mws/rest/notification-conditions?api-version=3

4.13.2.A  Update Notification Condition

URLs and Parameters

PUT https://localhost:8080/mws/rest/notification-conditions?api-version=3

See 3.3  Global URL Parameters for available URL parameters.

Request Body

The request body below shows some fields that are available when updating a notification condition, along with some sample values:

Sample JSON request body to update a notification condition
------------------------------------

{
    "details": {
        "pluginType": "NodeTester",
        "pluginId": "my-tester1"
    },
    "escalationLevel": "ADMIN",
    "expirationDuration": 30,
    "message": "Node 'node2' is powered off, please check your hardware.",
    "objectId": "node2",
    "objectType": "Node",
    "origin": "NodeTester/my-tester1/Test.groovy:141"
}

Sample Response

JSON response
------------------------------------

{
    "createdDate": "2024-09-10 23:13:33 UTC",
    "details": {
        "pluginType": "NodeTester",
        "pluginId": "my-tester1"
    },
    "escalationLevel": "ADMIN",
    "expirationDate": "2024-09-10 23:14:03 UTC",
    "expirationDuration": 30,
    "observedDate": "2024-09-10 23:13:33 UTC",
    "message": "Node 'node2' is powered off, please check your hardware.",
    "objectId": "node2",
    "objectType": "Node",
    "origin": "NodeTester/my-tester1/Test.groovy:141",
    "id": "5230a627e4b0d51bef490e86"
}

Related Topics